package com.main;

import com.alibaba.fastjson.JSON;

import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;

/**
 * Created by Samuel on 2016/11/8.
 */

@Controller
@RequestMapping("es")
public class MainController {

    @Autowired(required = true)
    private MainFace mainFace;


    @RequestMapping("test.api")
//    @ApiOperation(value="一个测试API",notes = "第一个测试api")
//    @ResponseBody
    public void test(HttpServletRequest request,
                     HttpServletResponse response,
                     CBean cBean){

        try {
            Object object = mainFace.testLink(cBean.getFunctionCount());
            response.setContentType("text/html;charset=utf-8");
            response.getWriter().write(JSON.toJSONString(object));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
